package pluginMain;

import java.util.logging.Logger;
import org.bukkit.plugin.java.JavaPlugin;

import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.selection.SelectionManager;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;

public class FastResident extends JavaPlugin {
	public final String PLUGIN_NAME = "RemiliaNetwork Test Plugin";
	public final Logger CONSOLE_LOGGER = this.getLogger();
	public com.bekvon.bukkit.residence.Residence residentInstance;
	public static SelectionManager selector;
	public void LOGCONSOLE(String msg) {
		CONSOLE_LOGGER.info(msg);
	}

	@Override
	public void onEnable() {
		LOGCONSOLE(PLUGIN_NAME + " has been started.");
		residentInstance = (Residence) getServer().getPluginManager().getPlugin("Residence");
		selector = residentInstance.getSelectionManager();
	}

	@Override
	public void onDisable() {
		LOGCONSOLE(PLUGIN_NAME + " has been disabled.");
	}
	
	@Override
	public boolean onCommand(CommandSender sender, Command command,
			String label, String[] args){
		String p = args[0];
		if(!(sender instanceof Player)) return false;
		Player s = (Player)sender;
		if(sender.hasPermission("FastResident.Use"))
		{
			
			if(p.equals("pos1")) selector.placeLoc1(s, s.getLocation());
			else if (p.equals("pos2")) selector.placeLoc2(s, s.getLocation());
			
			return true;
		}else{
			return false;
		}
		
		
	}

}
